package com.ysx.teacher.day20210909.ch04;

import java.util.ArrayList;

public class Ch04 {

    public static void main(String[] args) {


        ArrayList<Animal> arrayList =new ArrayList<Animal>();

        // 是否可以把猫放进去
        Cat cat  = new Cat();
        cat.setName("HelloKitty");
        cat.setColor("white");
        cat.setPrice(1000);

        // 拼爹
        arrayList.add(cat);

        Dog dog  = new Dog();
        dog.setName("小狗");
        dog.setPrice(1000);
        arrayList.add(dog);

        // 因为苹果不是动物 而是植物 间谍
        Apple apple  = new Apple();
        apple.setColor("red");
        apple.setPrice(5);
        //arrayList.add(apple);

    }
}
